﻿using Abp.Configuration.Startup;
using Abp.Localization.Dictionaries.Xml;
using Abp.Localization.Sources;
using Abp.Reflection.Extensions;

namespace Mt.Site.Core.Localization
{
    public static class MtSiteLocalizationExConfigurer
    {
        public static void Configure(ILocalizationConfiguration localizationConfiguration)
        {
            var assembly = typeof(MtSiteLocalizationExConfigurer).GetAssembly();

            #region 本地化XML

            localizationConfiguration.Sources.Extensions.Add(
                new LocalizationSourceExtensionInfo(
                    MtSiteConsts.LocalizationSourceName,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        assembly,
                        "Mt.Site.Core.Localization.AppSource"
                        )
                    )
                );

            localizationConfiguration.Sources.Extensions.Add(
                new LocalizationSourceExtensionInfo(
                    MtSiteConsts.LocalizationFrontendSourceName,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        assembly,
                        "Mt.Site.Core.Localization.AppFrontEnd"
                        )
                    )
                );

            localizationConfiguration.Sources.Extensions.Add(
                new LocalizationSourceExtensionInfo(
                    MtSiteConsts.LocalizationSourceName_Permissions,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        assembly,
                        "Mt.Site.Core.Localization.AppPermissions"
                    )
                )
            );

            localizationConfiguration.Sources.Extensions.Add(
                new LocalizationSourceExtensionInfo(
                    MtSiteConsts.LocalizationSourceName_Notification,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        assembly,
                        "Mt.Site.Core.Localization.AppNotifications"
                    )
                )
            );

            localizationConfiguration.Sources.Extensions.Add(
                new LocalizationSourceExtensionInfo(
                    MtSiteConsts.LocalizationSourceName_Navigation,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        assembly,
                        "Mt.Site.Core.Localization.AppNavigations"
                    )
                )
            );

            localizationConfiguration.Sources.Extensions.Add(
                new LocalizationSourceExtensionInfo(
                    MtSiteConsts.LocalizationSourceName_Feature,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        assembly,
                        "Mt.Site.Core.Localization.AppFeatures"
                    )
                )
            );

            #endregion
        }

    }
}
